1. Technical Field of the Invention
The present invention relates to an automatic generation of a program, and more particularly to a technique of automatically generating a data processing program for processing data with reference to the data of a table of a database constructed on an information processing system, storing the processing result once more in the table of the database, and updating or deleting the data of the table of the database based on the processing result.
2. Description of the Prior Art
Techniques for automatically generating a data processing program has been developed.
For example, JP1-147621 A (1989) discloses a system and method for generating automatically such data processing programs. The disclosed system comprises: input means for inputting specifications concerning data layout wherein attributes such as type and digit of each data item included in files and documents are defined, and for inputting specifications concerning calculation formulas; and program generation means for generating the corresponding batch work program. Further, the automatic program generating method comprises the steps of: inputting information on execution order such as data input/output order of files and documents and calculation order, into the input means of the specifications information; and generating the information on a program structure of a program to be generated, from the execution order information, in the program generating means.
A block diagram of the conventional program generation system as disclosed in JP1-147621 A (1989) is shown in FIG. 41. The specifications are inputted from a terminal into specifications input unit which further generates input/output relations, layout, generation formula and decision tables. Further, a data defining unit is generated from an input/output relation unit and a layout unit. A data editing unit is generated from the input/output relation unit and a generation formula unit. A program structure unit is generated from the input/output relation unit and a decision table unit. Finally, a program combining unit combines the data defining unit, the data editing unit, and the program structure unit.
Further, JP3-182932 A (1991) discloses a program automatic generating technique for the purpose of preventing errors and improving productivity. Concretely, this technique solves problems in program generation such as induction of user""s errors, or low productivity due to an increase in description amounts. Here, the problems arise from the fact that the COBOL language is so different from the SQL that it is laborious to describe a program by embedding a program of the SQL language in a program of the COBOL language.
A block diagram of the program generation system as disclosed in JP3-182932 A (1991) is shown in FIG. 42. A processing specification is inputted into data analysis unit. Then, data analysis and procedure analysis are executed. Further, the output from the procedure analysis unit is inputted into a definition unit, so as to automatically generate the SQL declarative section and the SQL communication area unfolding statement.
Although various automatic generating techniques have been disclosed, there is not found any article which describes an automatic generating technique of a data processing program for referring to, updating, and deleting the data of a table of a database constructed on an information processing system by use of a cursor definition statement. Concretely, JP1-147621 A (1989) merely discloses an automatic generation of a program dealing with a usual file and document, and use of a database is not assumed there. Further, JP3-182932 (1991) does not disclose automatic generation of cursor definition statement.
Generally, in a program dealing with a usual file and document, data is obtained from an input file, calculation processing is performed, and the result is stored in a new file. Therefore, also in JP1-147621 A (1989), on the assumption that a new file or document is generated as the output processing, the data of the existing file is never deleted and changed. The case of a database system, however, is characterized in that update and delete of an existing table by the record unit can be executed safely, and therefore, in a data processing program using a database, according to the cursor definition statement indicating which part of which table should be processed, data is obtained from the table input, calculation processing is performed, and based on the result, as is often the case, a new table is created, the existing table is updated, or deleted.
In the case of manual generation of this data processing program with reference to a detailed design similarly to the conventional way, there is a problem that a lot of processes are required, an error caused by human hands cannot be prevented, and that consistency of the detailed design and the program cannot be guaranteed. In the case of developing a large scale business program, it is necessary to install not only the business requirements but also the processing in the case of occurrence of system failure and access failure to a database or a network, which is difficult for a programmer of little experience of a business program, thereby causing a problem of deteriorating the quality of the developed program and the productivity of development. Therefore, the automatic generating technique of this kind of data processing program becomes a very important theme.
An object of the present invention is to automatically generate a data processing program for referring to, updating, or deleting the data of a table of a database.
Another object of the present invention is to reduce a user""s labor of describing specifications, by reducing the kind of information to be described in the specifications of the business requirements.
Further, another object of the present invention is to automatically generate various data processing programs from the specifications of the same business requirements.
The data processing program automatic generation system of the present invention for automatically generating a data processing program for referring to, updating, and deleting data of a table of a database, comprises: means for generating a cursor definition statement, a work variable definition statement, and an output processing statement, based on information obtained from specifications; and means for inserting the generated cursor definition statement, work variable definition statement, output processing statement, and program customize information within the specifications into each corresponding position of a program skeleton, including the program of a fixed portion regardless of the content of specifications and an inserting position of a piece of a program corresponding to a portion changeable according to the specifications of the data processing program,thereby completing the data processing program and outputting the same. More specifically, it comprises:
specification input means for inputting specifications including program name, input table item definition, select item definition, output table item definition, output table processing definition, select condition definition, and program customize information;
program skeleton customize information obtaining means for taking out the program name and the program customize information, as the information for customizing a program skeleton, from the specifications input by the specifications input means;
cursor definition information obtaining means for taking out the input table item definition, the select item definition, and the select condition definition, from the specifications input by the specifications input means;
output item processing information obtaining means for taking out the output table item definition and the output table processing definition, from the specifications input by the specifications input means;
cursor definition statement generating means for generating a cursor definition statement from the information obtained by said cursor definition information obtaining means;
work variable definition statement generating means for generating a work variable definition statement, from an output table belonging to the processing type xe2x80x9cinsertxe2x80x9d, of the output table item definition obtained by the output item processing information obtaining means;
output processing statement generating means for generating an output processing statement including a processing condition statement, an item calculation statement, and an insert statement in the case of the processing type xe2x80x9cinsertxe2x80x9d, generating an output processing statement including a processing condition statement and an update statement in the case of the processing type xe2x80x9cupdatexe2x80x9d, and generating an output processing statement including a processing condition statement and a delete statement in the case of the processing type xe2x80x9cdeletexe2x80x9d, from the output table item definition and the output table processing definition obtained by the output item processing information obtaining means; and
automatic program combining means for completing and outputting a program by inserting the program name and the program customize information obtained by the program skeleton customize information obtaining means, the cursor definition statement generated by the cursor definition statement generating means, the work variable definition statement generated by the work variable definition statement generating means, and the output processing statement generated by the output processing statement generating means, into the respective corresponding inserting positions of a program skeleton, including the program of a fixed portion regardless of the content of specifications and an inserting position of a piece of the program corresponding to a portion changeable according to specifications.
As mentioned above, a data processing program for referring to, updating, and deleting the data of a table of a database using a cursor definition statement can be automatically generated by generating the cursor definition statement, the work variable definition statement, and the output processing statement from specifications, and by inserting them into the corresponding inserting positions of the program skeleton prepared in advance. Since the program customize information of the specifications can be inserted into the corresponding inserting position of the program skeleton, the initial processing and the end processing, for example, specified by a user as the program customize information, can be built in, thereby making it easy to customize a program. Further, a processing program to cope with occurrence of a database access error, or a program for following a program rule obeyed by a lot of people concerned in the development, is established in advance, in a part of the fixed portion of a program regardless of the content of specifications, thereby reducing a user""s trouble of creating this part and preventing a user""s mistake.
Further, for the purpose of reducing a user""s trouble of describing specifications by reducing the kind of the information to be described in the specifications, the data processing program automatic generation system according to the present invention is constituted so that the cursor definition statement generating means generates a select item definition from the input table item definition, select condition definition, and output table processing definition, thereby generating a cursor definition statement from this generated select item definition and the select condition definition, as another structure. In this structure, a user can save a trouble of generating the select item definition. As further another structure, the specifications input means inputs all the input table names and output table names for use in the processing and retrieves all the item names of the corresponding input table and output table from the table definition information of a database to obtain the same. Thus, a user can save a trouble of generating an input table item definition and output table item definition. Further, the specifications input means represents the type information and all the item names of the obtained input table and output table on a screen, thereby making it possible for specifications describer to specify the specifications information other than the input table item definition and output table item definition, resulting in facilitating the description of the output table item definition, the output table processing definition, the select condition definition, and the like easy.
Further, in order to make it possible to automatically generate various data processing programs from the specifications of the same business requirements, the data processing program automatic generation system according to the present invention comprises a program skeleton library for storing several kinds of program skeletons including a program of the fixed portion regardless of the content of specifications and an inserting position of a piece of the program corresponding to the portion changeable according to specifications, and a program skeleton selecting means for selecting one program skeleton that a user specifies from this program skeleton library and passing it to the automatic program combining means.
According to the present invention, when a software developer develops a data processing program for newly creating, updating, or deleting the data of a database table using a cursor definition statement, only describing specifications of processing can generate a program automatically and he or she can make use of it.
In the structure of automatic generation of a select item definition, a software developer can save the trouble of describing specifications and reduce a risk of producing an error. Similarly, in the structure of retrieving and obtaining the input table item definition and the output table item definition from the table definition information of a database, a software developer can save the trouble of describing specifications and reduce a risk of producing an error.
Further, in the structure of selecting any program skeleton from a plurality of kinds of program skeletons, various data processing programs such as a program written in a different programming language, a program in a different algorithm, a program based on the different method of processing abnormal operation, or the like can be automatically generated, from specifications of the same business requirements.
Further, since the whole program can be automatically generated, manual generation of a program is not necessary and a trouble of program development can be reduced extremely.
Further, since the manual work can be reduced extremely in the program development, an opportunity of producing a mistake by the manual work can be reduced extremely, thereby reducing the mixing of an error into a program, to a high degree.
Further, by embedding the processing to cope with access failure to a database and a network, or system failure, in other words, the processing that is filled with the knowledge of a program developer of extensive experience, within a program skeleton, a program for performing the complicate processing can be automatically generated from the specifications in which only the business requirements are described, thereby making it possible even for a program developer of less experience of developing a business program to develop a program of high quality at the same level as that of an experienced developer.
Further, in maintenance of a system, maintenance is performed not by a program, but by specifications, thereby making the maintenance much easier. This is why, automatic generation of a program from specifications means one-to-one correspondence of the program and the specifications, in the necessity of amending a system, not the program is directly amended, but the specifications are amended, thereby automatically generating the program from the amended specification, for the maintenance.